<?php
/**
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file license.txt or that can be found at 
 * http://code.google.com/p/billboardce/wiki/License.
 *
 * @package    Oauth_Util
 * @category   Library
 * @license    http://code.google.com/p/billboardce/wiki/License New BSD License
 * @version    SVN: $Id: $
 */

/**
 * @package    Oauth_Util
 * @category   OAuth
 */
class Oauth_Util
{
	public static function urlencodeRfc3986($input)
	{
		if (is_array($input)) {
			return array_map(array('Oauth_Util', 'urlencodeRfc3986'), $input);
		} else if (is_scalar($input)) {
			return str_replace('+', ' ', str_replace('%7E', '~', rawurlencode($input)));
		} else {
			return '';
		}
	}
	
	// This decode function isn't taking into consideration the above 
	// modifications to the encoding process. However, this method doesn't 
	// seem to be used anywhere so leaving it as is.
	public static function urldecodeRfc3986($string)
	{
		return rawurldecode($string);
	}
}